<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:80:"D:\Code\matian\matian\application\weixin\view\default\question_answer\index.html";i:1493893766;s:72:"D:\Code\matian\matian\application\weixin\view\default\public/layout.html";i:1491744644;}*/ ?>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <title>疑问解答</title>
    <?php echo _css('css/phone.css'); echo _css('static/css/weui.css'); echo _css('css/weui2.css'); ?>

</head>
<body>
    

<div class="form mt10" id="form1">
    <div class="flex border-b">
        <label for="username">姓名</label>
        <div class="flex-con">
            <input type="text" class="form-control" name="username" id="username" placeholder="请输入联系人">
        </div>
    </div>
    <div class="flex border-b">
        <label for="telephone">联系电话</label>
        <div class="flex-con">
            <input type="tel" class="form-control" name="telephone" id="telephone" placeholder="请输入联系电话">
        </div>
    </div>
    <div class="mt10 border-t border-b">
        <textarea name="question"  class="form-control text-left" id="question" rows="5" placeholder="请输入问题内容"></textarea>
    </div>
</div>

<div class="btn-area">
    <div id="submitBtn" class="bg-primary btn-block btn">提交问题</div>
</div>

<div class="footer-fixed">客服电话: <?php echo ccnn_sys_setting('客服电话',''); ?></div>

<?php echo _js('static/layermobile/layer.js'); echo _js('js/phone.js'); echo _js('static/js/zepto.min.js'); echo _js('static/js/weui.js'); echo _js('js/picker.js'); ?>


<script>
    $(function () {
        $('#submitBtn').on('click', function () {
            var postData = {};
            var is_valid = true;
            $('#form1').find('input[name],textarea[name]').each(function () {
                if (!this.value.trim() && this.name != 'address') {
                    is_valid = false;
                    ui.msg($(this).attr('placeholder'));
                    return false;
                }
                postData[this.name] = this.value.trim();
            });
            var len = postData['question'].length;
            if(len<50 || len > 500){
                ui.msg('问题内容必须在50到100个字符之间');
                return;
            }
            if (is_valid) {
                ui.toast.show();
                $.post("<?php echo U('save'); ?>", postData, function (rt) {
                    ui.toast.hide();
                    if (rt.status == 1) {
                        location.href = "<?php echo U('index/index'); ?>";
                    } else {
                        ui.msg(rt.info);
                    }
                }, 'json');
            }
        });
    });
</script>


    
        <?php echo W('WxJsApi/shared'); ?>
    
</body>
</html>